package com.etc.serviceimpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.etc.dao.VideosMapper;
import com.etc.entity.LayuiDate;
import com.etc.entity.Videos;
import com.etc.service.VideosService;
import com.github.pagehelper.Page;
@Service
public class VideosServiceImpl implements VideosService {

	@Autowired
	VideosMapper videosMapper;
	
	
	@Override
	public Videos selectVideo(int videoId) {
		// TODO Auto-generated method stub
		return videosMapper.selectVideo(videoId);
	}
	@Override
	public List<Videos> selectVideos() {
		// TODO Auto-generated method stub
		return videosMapper.selectVideos();
	}

	@Override
	public boolean addVideos(Videos videos) {
		// TODO Auto-generated method stub
		return videosMapper.addVideos(videos);
	}

	@Override
	public boolean updateVideos(Videos videos) {
		// TODO Auto-generated method stub
		return videosMapper.updateVideos(videos);
	}

	@Override
 
	public LayuiDate<Videos> selectVideosByPageLike(int start, int limit, String keywords) {

			int page = (start - 1) * limit;
		List<Videos> count = videosMapper.queryVideosCount(keywords);
		List<Videos> list = videosMapper.selectVideosByPage(page, limit, keywords);
		
		LayuiDate<Videos> layuiDate = new LayuiDate<>(0, "", count.size(), list);

		return layuiDate;
	}

	
	@Override
	public List<Videos> selectVideosByType(String type) {
		// TODO Auto-generated method stub
		return videosMapper.selectVideosByType(type);
	}
	
	@Override
	public boolean deleteVideo(int videoId) {
		// TODO Auto-generated method stub
		return videosMapper.deleteVideo(videoId);
	}
	@Override
	public List<Videos> queryVideosCount(String keywords) {
		// TODO Auto-generated method stub
		return videosMapper.queryVideosCount(keywords);
	}

	@Override
	public Videos selectVideoByPick(String videoName, int videoNumber) {
		// TODO Auto-generated method stub
		return videosMapper.selectVideoByPick(videoName, videoNumber);
	}
	
	@Override
	public List<Videos> selectVideoByPickList(String videoName) {
		// TODO Auto-generated method stub
		return videosMapper.selectVideoByPickList(videoName);
	}
	@Override
	public List<Videos> selectVideoByName() {
		// TODO Auto-generated method stub
		return videosMapper.selectVideoByName();
	}
	@Override
	public List<Videos> selectVideosByPage(int start, int limit, String keywords) {
		// TODO Auto-generated method stub
		return videosMapper.selectVideosByPage(start, limit, keywords);
	}
	
	@Override
	public List<Videos> searchVideo(String searchLike) {
		// TODO Auto-generated method stub
		return videosMapper.searchVideo(searchLike);
	}
	
	@Override
	public List<Videos> getOneCount(String videoName) {
		// TODO Auto-generated method stub
		return videosMapper.getOneCount(videoName);
	}

	@Override
	public List<Videos> selectVideosPerson(String videoName) {
		// TODO Auto-generated method stub
		return videosMapper.selectVideosPerson(videoName);
	}
}
